package com.eclipse.e20200122_反射.晨考_反射;

public class Test {
	public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
//		Class clas = Person.class;
		Class clas = Class.forName("晨考_反射.Person");

		Person person = (Person) clas.newInstance();
		
		System.out.println("修改前:"+person.getName());
		
		person.setName("gin");
		System.out.println("修改后:"+person.getName());
	}
}

class Person{
	private String name = "dasy";

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
}